Redact credentials at tool-error construction and in source_errors - #234
Conversation
📝 WalkthroughWalkthroughCredential-shaped substrings are now redacted during tool-error construction, ChangesCredential Redaction Hardening
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PineconeSource
participant SourceRegistry
participant redactErrorMessage
participant list_namespaces
participant redactSensitiveFields
PineconeSource->>SourceRegistry: reject namespace listing
SourceRegistry->>redactErrorMessage: sanitize rejection reason
redactErrorMessage-->>SourceRegistry: redacted source_errors entry
SourceRegistry->>list_namespaces: return partial result
list_namespaces->>redactSensitiveFields: serialize MCP response
redactSensitiveFields-->>list_namespaces: redacted response text
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #234 +/- ##
=======================================
Coverage ? 86.00%
=======================================
Files ? 47
Lines ? 2537
Branches ? 856
=======================================
Hits ? 2182
Misses ? 353
Partials ? 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/SECURITY.md`:
- Line 29: Update the UUID-preservation statement in SECURITY.md to limit the
claim to MCP response construction, aggregation, and serialization layers.
Remove the broad “at every layer” wording while preserving the separate behavior
that UUID-shaped tokens are redacted from logs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4875882f-2db0-43d5-a387-c1ff83a2a8a5
📒 Files selected for processing (11)
docs/SECURITY.mdsrc/core/pinecone/rerank.tssrc/core/server/redaction.test.tssrc/core/server/retry.tssrc/core/server/source-registry.test.tssrc/core/server/source-registry.tssrc/core/server/tool-error.tssrc/core/server/tools/list-namespaces-tool.context.test.tssrc/core/server/tools/test-helpers.tssrc/index.tssrc/logger.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/server/tool-error.ts`:
- Line 126: Update the suggestion assignment in the tool-error construction to
distinguish an omitted value from an explicitly provided empty string, using an
undefined check or nullish fallback while still applying redactApiKey to
supplied strings. Add a regression test covering an empty options.suggestion and
verify it is preserved instead of replaced by DEFAULT_TIMEOUT_SUGGESTION.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7d7050c1-8bbd-479f-8370-da8dc5775f4a
📒 Files selected for processing (3)
docs/SECURITY.mdsrc/core/server/tool-error.test.tssrc/core/server/tool-error.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/SECURITY.md
Summary
messageandsuggestioninpineconeToolError/timeoutToolErrorat construction so DEBUG-mode SDK errors are masked on the returnedToolError, not only at serialization timesource_errorsat construction (source-registry.ts) and inredactSensitiveFields(logger.ts)redactErrorMessagehelper and use it in shared error pathssource_errorsunit/construction/e2e coverage, and UUID metadata regressiondocs/SECURITY.mdto document construction-layer + boundary-layer redactionTest plan
npm test(434 tests)npm run typechecknpm run lintnpm run format:checknpm run buildRelated issue
source_errorsleak #229Summary by CodeRabbit
Bug Fixes
source_errors, Pinecone reranking failures, and CLI error output.source_errorssanitization to reliably redact nested string values while preserving non-sensitive metadata.suggestionis always present and correctly handled when omitted or provided.Documentation
Tests